using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Services;
using JigLibX.Physics;
using Utilities;
using SpaceBattle.Logic;
using SpaceBattle.Logic.SampleLevel;


namespace SpaceBattle
{
    using Nuke = Projectile;
    using NukeData = ProjectileData;

    public abstract class PlayerLayer : EffectsLayer
    {
        public PlayerLayer(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
        }

        protected override void DrawPlayerShip(GameTime gameTime, State current_state, ModelWithVolumes Player)
        {
            var player_ship = current_state.player.AsShip;

            GraphicsDevice.BlendState = BlendState.Opaque;
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            if (current_state.player.age > current_state.player.INVULNERABILITY_SPAWN_TIME
                || Math.Abs(Math.Sin(current_state.player.age * 8)) > 0.7)
            {
                Player.Model.DrawAsBody(player_ship.geometry, view, projection);
                DrawPlayerEngines(Player, gameTime, player_ship.geometry, player_ship.engines);
            }
        }



    }
}
